home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Just Call Me Internet
/
Just Call Me Internet.iso
/
com
/
computer
/
casio_st
/
prog_fx
/
divers
/
simplex.sha
< prev
next >
Wrap
Text File
|
1994-03-01
|
2KB
|
72 lines
10 REM METHODE DU SIMPLEX
20 REM (C) WILLYTEL JUIN 89
30 REM 24H/7H AU 62.93.74.05
40 REM ENTREE VALEURS
50 A$="":INPUT "CLEAR ALL ?";A$:IF A$="O" THEN CLEAR
60 INPUT "Nombre de var:";NVAR
70 INPUT "Nombre d'equation:";NEQ
80 XX=NVAR+3
90 YY=NEQ+1
100 DIM T(XX,YY)
110 DIM R(YY)
120 REM ENTREE TABLEAU
130 FOR Q=1 TO YY-1
140 FOR P=3 TO XX-1
150 PRINT P-2;" ";Q;CHR$(13);:INPUT "Coef eq:";T(P,Q)
160 NEXT P
170 INPUT "Resultat:";T(P,Q)
180 NEXT Q
190 REM ENTREE Z
200 FOR P=3 TO XX-1
210 PRINT P-2;CHR$(13);:INPUT "Coef Z:";T(P,YY)
220 NEXT P
230 REM ENTREE SOLUTION BASE
240 FOR P=1 TO YY-1
250 INPUT "X(i)?:";T(2,P)
260 T(1,P)=T(T(2,P)+2,YY)
270 T(XX,YY)=T(XX,YY)+T(1,P)*T(XX,P)
280 NEXT P
290 GOSUB 630
300 REM CALCUL Z MAX
310 MZ=0
320 FOR P=3 TO XX-1
330 IF T(P,YY)>MZ THEN MZ=T(P,YY):J=P
340 NEXT P
350 PRINT "Vecteur entre:";J-2
360 REM CAL VECT SORT
370 MIN=9*10^30
380 FOR P=1 TO YY-1
390 IF T(J,P)=0 THEN R(P)=9*10^30
400 IF T(J,P)<>0 THEN R(P)=T(XX,P)/T(J,P)
410 IF R(P)>0 AND R(P)<MIN THEN MIN=R(P):L1=P
420 NEXT P
430 PRINT "Vecteur sortant:";T(2,L1)
440 T(2,L1)=J-2
450 T(1,L1)=T(T(2,L1)+2,YY)
460 PAS1=T(J,L1)
470 FOR P=3 TO XX
480 T(P,L1)=T(P,L1)/PAS1
490 NEXT P
500 FOR P=1 TO YY-1
510 IF T(J,P)=0 OR P=L1 THEN GOTO 520
520 CO=T(J,P)
530 FOR Q=3 TO XX
540 T(Q,P)=T(Q,P)-CO*T(Q,L1)
550 NEXT Q
560 NEXT P
570 CC=T(J,YY)
580 FOR P=3 TO XX-1
590 T(P,YY)=T(P,YY)-T(P,L1)*CC
600 NEXT P
610 T(XX,YY)=T(XX,YY)+T(XX,L1)*CC
620 GOSUB 630:GOTO 300
630 REM AFFICHAGE
640 FOR P=1 TO YY
650 FOR Q=1 TO XX
660 PRINT T(Q,P);" ";
670 NEXT Q
680 PRINT" "
690 NEXT P
700 INPUT "Encore?";A$
710 RETURN